/*
 * Copyright (C) 2009-2018 Hangzhou 2Dfire Technology Co., Ltd. All rights reserved
 */
package com.ws.soa.consumer.controller;

import com.google.common.base.Preconditions;
import com.ws.soa.consumer.service.MessageService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * smsController
 * 获取验证码接口
 *
 * @author luobosi@2dfire.com
 * @since 2019-02-18
 */
@RestController
@RequestMapping(("/message"))
public class VerifyCodeController {

    @Resource
    private MessageService messageService;

    /**
     * 获取短信验证码
     *
     * @return true/false
     */
    @GetMapping(value = "/sms_verify_code/{mobile}")
    public Boolean getSmsVerifyCode(@PathVariable String mobile) {
        Preconditions.checkArgument(StringUtils.isNotEmpty(mobile));
        this.messageService.sendVerifyCode(mobile);
        return Boolean.TRUE;
    }


    /**
     * 获取图形验证码
     *
     * @return code
     */
    public String getCaptcha() {
        return "";
    }
}
